package com.sharemarking.system.controller;

import com.sharemarking.system.service.ImageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("system/show")
public class ImageShowController {
	@Autowired
	private ImageService is;
	/**
     * 上传图片弹出框
     * @param
     * @return
     */
    @RequestMapping(value="showImagePage/{type}/{image}",method= RequestMethod.GET)
    public String showImagePage(@PathVariable("image")String image, @PathVariable("type")String type, Model model){
    	model.addAttribute("imageBasePath",is.getImageBasePath());
    	model.addAttribute("imageName",image);
    	model.addAttribute("imageType",type);
        return "system/image/imageForm";
    }
    /**
     * 上传视频弹出框
     * @param
     * @return
     */
    @RequestMapping(value="showVideoPage/{type}/{image}",method= RequestMethod.GET)
    public String showVideoPage(@PathVariable("image")String image, @PathVariable("type")String type, Model model){
    	model.addAttribute("imageBasePath",is.getImageBasePath());
    	model.addAttribute("imageName",image);
    	model.addAttribute("imageType",type);
    	return "system/image/videoForm";
    }
    /**
     * 上传文件弹出框
     * @param
     * @return
     */
    @RequestMapping(value="showFilePage/{type}/{image}",method= RequestMethod.GET)
    public String showFilePage(@PathVariable("image")String image, @PathVariable("type")String type, Model model){
    	model.addAttribute("imageBasePath",is.getImageBasePath());
    	model.addAttribute("imageName",image);
    	model.addAttribute("imageType",type);
    	return "system/image/fileForm";
    }


	/**
	 * 上传图片弹出框(多图片)
	 * @param
	 * @return
	 */
	@RequestMapping(value="showMultiImagePage/{type}/{image}",method= RequestMethod.GET)
	public String showMultiImagePage(@PathVariable("image")String image, @PathVariable("type")String type, Model model){
		model.addAttribute("imageBasePath",is.getImageBasePath());
		model.addAttribute("imageName",image);
		model.addAttribute("imageType",type);
		return "system/image/multiImageForm";
	}
}
